package com.etrans.web.gps.business.gis.service;

import java.util.HashMap;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.etrans.web.gps.base.service.BaseService;
import com.etrans.web.gps.business.gis.domain.CustomMapPoint;

@Service
public class CustomMapPointService  extends BaseService{
	

	
	/**
	 * @param contactperson
	 */
	@Transactional(readOnly = false, rollbackFor = { DataAccessException.class,
			Exception.class })
	public void saveCustomMapPoint(CustomMapPoint customMapPoint) {
		this.insert("customMapPointMapper.saveCustomMapPoint", customMapPoint);

	}
	
	/**
	 * 批量插入
	 * @param contactperson
	 */
	@Transactional(readOnly = false, rollbackFor = { DataAccessException.class,
			Exception.class })
	public void insertCustomMapPoint(List<CustomMapPoint> customMapPointList) {
		this.insert("customMapPointMapper.insertCustomMapPoint", customMapPointList);

	}
	
	/**
	 * @param contactperson
	 */
	@Transactional(readOnly = false, rollbackFor = { DataAccessException.class,
			Exception.class })
	public void updateCustomMapPoint(CustomMapPoint customMapPoint) {
		this.update("customMapPointMapper.updateCustomMapPoint", customMapPoint);
	}
	
	/**
	 * @param id
	 */
	@Transactional(readOnly = false, rollbackFor = { DataAccessException.class,Exception.class })
	public void deleteCustomMapPointByID(Integer id) {
		this.delete("customMapPointMapper.deleteCustomMapPointByID", id);
	}
	
	/**
	 * @param id
	 * @return
	 */
	public CustomMapPoint queryCustomMapPointById(Integer id) {
		CustomMapPoint CustomMapPoint = (CustomMapPoint) this.selectOne("customMapPointQuery.queryCustomMapPointById", id);
		return CustomMapPoint;
	}
	
 
	/**
	 * 判断重复
	 * 
	 * @param param  
	 * @return
	 */
	public boolean queryisReCustomMap(HashMap<String, Object> param) {
		boolean result=false;
		List<HashMap<String, Object>> list =	this.selectList("customMapPointQuery.queryisReCustomPoint", param);
		if(null!=list&&list.size()>0){
			result=true;
		}
		return result ; 
	} 
	
	public List<CustomMapPoint> queryAllCustomMapPoint(HashMap<String, Object> param) {
		return  this.selectList("customMapPointQuery.queryAllCustomMapPoint", param);
	}

	public long CustomMapPointCount(HashMap<String, Object> param) {
		return (Long) this.selectOne("customMapPointQuery.customMapPointCount", param);
	}
	
	public Object checkCustomcode(String customcode,String id,String workunitid) {
		HashMap<String, Object> param = new HashMap<String, Object>();
		param.put("customcode", customcode);
		param.put("id", id);
		return  this.selectOne("customMapPointQuery.checkCustomcode", param);
	}
	
}
